<template>
  <div class="test-container">
    <h2>测试页面</h2>
    <button class="halo-btn" @click="fetchData">调用接口</button>
    <p>输入：{{ value }}</p>
    <van-number-keyboard
      :show="visible"
      @input="onInput"
      @delete="onDelete"
      @focus="() => console.log(1234)"
    />
  </div>
</template>

<script>
import { onMounted, ref } from 'vue';
import * as Api from '@/api/user';

export default {
  setup() {
    const value = ref('1234');
    const visible = ref(false);
    const fetchData = async () => {
      const res = await Api.login();
      console.log(res);
    };
    const onInput = (v) => {
      value.value += v;
    };
    const onDelete = () => {
      value.value = '';
    };

    onMounted(() => {
      visible.value = true;
    });

    return { fetchData, value, visible, onInput, onDelete };
  },
};
</script>

<style class="less" scoped>
.test-container {
  min-height: 100vh;
  background-color: #f5f5f5;
}
</style>